from sqlalchemy import Column, Integer, String,DateTime
from core.base.orm_model import Base,TimestampMixin
from datetime import datetime

class Salesperson(Base, TimestampMixin):
    __tablename__ = "salesperson"
    
    id = Column(Integer, primary_key=True, index=True, comment='业务员ID')
    name = Column(String(50), nullable=False, comment='业务员姓名')
    department = Column(String(50), nullable=False, comment='所属事业部')
    type = Column(String(50), nullable=False, comment='类型')
    pm = Column(String(50), nullable=False, comment='PM')
    status = Column(String(50), nullable=False, comment='状态')
    supervisor = Column(String(50), nullable=False, comment='主管')
    is_supervisor = Column(String(1), nullable=False, comment='是否主管')
    third_department = Column(String(50), nullable=False, comment='三级部门')
    industry = Column(String(20), nullable=False, comment='行业')
    create_time = Column(DateTime, default=datetime.now, comment="创建时间")
    update_time = Column(DateTime, default=datetime.now, onupdate=datetime.now, comment="更新时间")    

    def __repr__(self):
        return f"<Salesperson {self.name}>"